//
// Created by lijinpeng on 2022/4/3.
//

#ifndef TSIENEDITOR_DISPLAY_H
#define TSIENEDITOR_DISPLAY_H
#include "memory"
#include "QString"
#include "QMap"
#include "QColor"
#include "QBitmap"
#include "DisplayBasic.h"
using namespace std;

class Display {
public:
    static shared_ptr<Display> FromFile(const QString &file_path);
    shared_ptr<Packet> GetDisplay(const QString layer , const QString & purpose);

private:
    QMap<QString, Color> Colors;
    QMap<QString, Stipple> Stipples;
    QMap<QString, LineStyle> LineStyles;
    QMap<QString, Packet> Packets;

    static shared_ptr<Display> &ParserColor(shared_ptr<Display> &display, const QJsonObject &root_obj);

    static shared_ptr<Display> &ParserStipper(shared_ptr<Display> &display, const QJsonObject &root_obj);

    static shared_ptr<Display> &ParserLineStyle(shared_ptr<Display> &display, const QJsonObject &root_obj);

    static shared_ptr<Display> &ParserPacket(shared_ptr<Display> &display, const QJsonObject &root_obj);
};

using DisplayPtr = shared_ptr<Display>;
#endif //TSIENEDITOR_DISPLAY_H
